﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using MethodWorx.CMS.Content;

namespace MethodWorx.CMS.Plugins.CssManagement
{
    public class PageTemplateCssManagement : Controller
    {
        private PluginService service;
        private IdeExtension extension;

        /// <summary>
        /// Required constructor, must have an "extension" argument
        /// and any other arguments the dependency injection contain knows about
        /// </summary>
        /// <param name="extension"></param>
        /// <param name="service"></param>
        public PageTemplateCssManagement(IdeExtension extension, PluginService service)
        {
            this.service = service;
            this.extension = extension;
        }

        /// <summary>
        /// Invoke method, default action for the get
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Invoke(PageTemplate instance)
        {
            return new EmbeddedViewResult(this.extension.WebEditor, instance);
        }

        /// <summary>
        /// Invoke method, default action for the post
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="submit"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult Invoke(PageTemplate instance, string submit)
        {
            return new EmbeddedViewResult(this.extension.WebEditor, this.ViewData, instance);
        }
    }
}
